<template>
  <div>
    <p>B 节点</p>
    <hr />
    <!-- 通过 v-ant-ref 变成回调的形式, childrenC 更新/实例化完成 的时候, 调用回调，主动通知到上层的节点 -->
    <children-d v-ant-ref="(c) => setChildrenRef('childrenD', c)"></children-d>
  </div>
</template>

<script>
import ChildrenD from "./ChildrenD.vue";

export default {
  components: { ChildrenD },
  inject: {
    setChildrenRef: {
      default: () => {},
    },
  },
};
</script>

<style scoped>
div {
  background-color: pink !important;
  border-radius: 4px;
  padding: 0 10px;
  margin-bottom: 10px;
}
</style>
